/**
 * Created by aa on 2016/8/31.
*/
'use strict';
var utils=require('../common/utils');
var cac=utils.cac;
var receiveNewsDetail;

//获取公司历程
const RECEIVE_PROCESS_ITEMS='RECEIVE_PROCESS_ITEMS';
//荣誉
const RECEIVE_EGO_ITEMS='RECEIVE_EGO_ITEMS';
//领导
const RECEIVE_LEADER_ITEMS='RECEIVE_LEADER_ITEMS';
//团队
const RECEIVE_TEAM_ITEMS='RECEIVE_TEAM_ITEMS';
//招聘职位
const RECEIVE_POSITION_ITEMS='RECEIVE_POSITION_ITEMS';
//财富新闻
const RECEIVE_NEWS_DETAIL='RECEIVE_NEWS_DETAIL';



//对外暴露变量
exports.RECEIVE_PROCESS_ITEMS=RECEIVE_PROCESS_ITEMS;
exports.RECEIVE_EGO_ITEMS=RECEIVE_EGO_ITEMS;
exports.RECEIVE_LEADER_ITEMS=RECEIVE_LEADER_ITEMS;
exports.RECEIVE_TEAM_ITEMS=RECEIVE_TEAM_ITEMS;
exports.RECEIVE_POSITION_ITEMS=RECEIVE_POSITION_ITEMS;
exports.RECEIVE_NEWS_DETAIL=RECEIVE_NEWS_DETAIL;

exports.receiveProcessItems=cac(RECEIVE_PROCESS_ITEMS,'processItems');
exports.receiveEgoItems=cac(RECEIVE_EGO_ITEMS,'egoItems');
exports.receiveLeaderItems=cac(RECEIVE_LEADER_ITEMS,'leaderItems');
exports.receiveTeamItems=cac(RECEIVE_TEAM_ITEMS,'teamItems');
exports.receivePositionItems=cac(RECEIVE_POSITION_ITEMS,'positionItems');
exports.receiveNewsDetail=receiveNewsDetail=cac(RECEIVE_NEWS_DETAIL,'newsDetail');

//对外暴露方法

//新闻换页
exports.getNewsByNumber=(pageNumber,pageSize)=>{
    return (dispatch, getState) => {
        reqwest({
            url: '/api/article/type/NEWS?channel=0&curPage='+(pageNumber-1)+'&pageSize='+pageSize,
            method: 'get',
            contentType: 'application/json'
        })
            .then(function (data) {
                dispatch(receiveNewsDetail(data));
            })
            .fail(function (err, msg) {
                alert('获取数据出错');
            })
    }
};